<?php
/**
 * Project: Recipe
 * File: FoodCategoryModel.class.php
 * Author: Xnfy520@gmail.com
 * Date: 12-4-18
 * Time: 上午10:13
 */

	class FoodCategoryModel extends RelationModel{

		protected $_validate = array(
			array('name', 'require', '食材分类名称不能为空', 1, 'regex', 3),
			array('sort', 'number', '排序必须为数字', 1, 'regex', 3),
		);

		protected $_link = array(

			'FoodArticle'=>array(
				'mapping_type'=>HAS_MANY,
				'mapping_name'=>'foodarticle',
				'class_name'=>'FoodArticle',
				'foreign_key'=>'categoryid',
			),

			'FoodSection'=>array(
				'mapping_type'=>BELONGS_TO,
				'mapping_name'=>'foodsection',
				'class_name'=>'FoodSection',
				'foreign_key'=>'foodsectionid',
			),
		);

	}